package com.tuanbiao.dialog;

import android.content.Context;
import android.view.Gravity;

import androidx.appcompat.widget.AppCompatTextView;

import com.daimajia.numberprogressbar.NumberProgressBar;
import com.tuanbiao.R;

/**
 * @author abiao
 * @since 2022/4/18 15:47
 */
public class CustomProgressDialog {

    public static final class Builder
            extends BaseDialog.Builder<Builder> {

        private NumberProgressBar progressBar;
        private AppCompatTextView tvMsg;

        public Builder(Context context) {
            super(context);
            setAnimStyle(BaseDialog.ANIM_TOAST);
            setBackgroundDimEnabled(true);
            setCancelable(false);
            setContentView(R.layout.dialog_progress);
            setGravity(Gravity.CENTER);

            progressBar = findViewById(R.id.npb_content);
            tvMsg = findViewById(R.id.tv_msg);
        }

        public Builder setMessage(String msg) {
            tvMsg.setText(msg);
            return this;
        }

        public void setProgress(int progress) {
            progressBar.setProgress(progress);
        }
    }
}
